package vn.bang.xiangqi.components;

import java.util.Collection;

import vn.bang.xiangqi.infrastructure.Position;
import vn.bang.xiangqi.infrastructure.Vector;
import vn.bang.xiangqi.utility.BoardUtil;

public class Advisor extends AbstractBaseNode {
	public Advisor() {
		super();
	}

	public Advisor(Position originalPosition) {
		super(originalPosition);
	}

	static private Vector[] ADVISOR_VECTORS = { new Vector(-1, -1),
			new Vector(+1, -1), new Vector(+1, +1), new Vector(-1, +1), };

	@Override
	protected boolean notPrevented(Vector vector, Collection<INode> ours,
			Collection<INode> enemies) {
		return true;
	}

	@Override
	protected Vector retrieveVectorMovingTo(Position destinationPosition) {
		if (null == destinationPosition
				|| !BoardUtil.IsInBoard(destinationPosition)) {
			return null;
		}

		return retrieveVectorValidInOurBarrack(destinationPosition,
				ADVISOR_VECTORS);
	}

}